<? 
include("../connect.php");
$kode=$_POST["kegiatan"];
$kodehapus=$kode;
$pilih=mysql_select_db("uwika_skk",$conn);
$sqlstr="SELECT max(kode) from kegiatan";
$hasil=mysql_query($sqlstr);
list($kodetop) = mysql_fetch_row($hasil);
$sqlstr="delete from kegiatan where kode='$kode'";
$hasil=mysql_query($sqlstr);
$sqlstr="delete from score where kode='$kode'";
$hasil=mysql_query($sqlstr);
$sqlstr="update kegiatan set kode='$kodehapus' where kode='$kodetop'";
$hasil=mysql_query($sqlstr);
$sqlstr="update score set kode='$kodehapus' where kode='$kodetop'";
$hasil=mysql_query($sqlstr);
mysql_close($conn);
echo " <SCRIPT> alert(\"Data anda telah dihapus.\") </SCRIPT> ";
echo "<meta http-equiv=\"refresh\" content=\"0; url=set_kegiatan.php\">";
echo "Klik <a href=\"set_kegiatan.php\">disini</a> apabila browser anda berhenti berjalan ...";
?>
